*CONCORDANCE RANKINGS

use "SHG Survey.dta", clear

gen Aft=(TYPE==2) 
label var Aft "Post intervention"
gen SewaV=(avs==1)
label var SewaV "SEWA Village"
gen SM=(q84==1)
replace SM=0 if SewaV==0
replace SM=0 if Aft==0
label var SM "SEWA Member"
gen SewaVXAft=Aft*SewaV
label var SewaVXAft "Sewa V



*Top ranked issues (whether issue is #1)

gen rank1 = 0
gen rank2 = 0
gen rank3 = 0
gen rank4 = 0
gen rank5 = 0
gen rank6 = 0
gen rank7 = 0

replace rank1 = 1 if Q34s_1==1
replace rank2 = 1 if Q34s_1==2
replace rank3 = 1 if Q34s_1==6
replace rank4 = 1 if Q34s_1==4
replace rank5 = 1 if Q34s_1==5
replace rank6 = 1 if Q34s_1==7
replace rank7 = 1 if Q34s_1==3

replace rank1 = . if Q34s_1>8|Q34s_1==.
replace rank2 = . if Q34s_1>8|Q34s_1==.
replace rank3 = . if Q34s_1>8|Q34s_1==.
replace rank4 = . if Q34s_1>8|Q34s_1==.
replace rank5 = . if Q34s_1>8|Q34s_1==.
replace rank6 = . if Q34s_1>8|Q34s_1==.
replace rank7 = . if Q34s_1>8|Q34s_1==.

drop if rank1==.|rank2==.|rank3==.|rank4==.|rank5==.|rank6==.|rank7==.

label var rank1 "water top ranked"
label var rank2 "sanitation top ranked"
label var rank3 "health top ranked"
label var rank4 "electricity top ranked"
label var rank5 "education top ranked"
label var rank6 "work top ranked"
label var rank7 "roads top ranked"


*Types of raters

gen control0 = 0
gen treatment0 = 0
gen treatmentA0 = 0
gen treatmentB0 = 0

replace control0 = 1 if SewaV==0&Aft==0
replace treatment0 = 1 if SewaV==1&Aft==0
replace treatmentA0 = 1 if SewaV==1&SM==1&Aft==0
replace treatmentB0 = 1 if SewaV==1&SM==0&Aft==0

gen control1 = 0
gen treatment1 = 0
gen treatmentA1 = 0
gen treatmentB1 = 0

replace control1 = 1 if SewaV==0&Aft==1
replace treatment1 = 1 if SewaV==1&Aft==1
replace treatmentA1 = 1 if SewaV==1&SM==1&Aft==1
replace treatmentB1 = 1 if SewaV==1&SM==0&Aft==1

keep id Village rank? control? treatment? treatmentA? treatmentB?
